﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace IceDog.WebApi.AnythingApi.Controllers
{
    /// <summary>
    /// Http 状态码
    /// </summary>
    [Route("[controller]")]
    [ApiController]
    public class HttpStatusCodeController : ControllerBase
    {
        private readonly ILogger<HttpStatusCodeController> _logger;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="logger"></param>
        public HttpStatusCodeController(ILogger<HttpStatusCodeController> logger)
        {
            _logger = logger;
            _logger.LogInformation("Create Instance Of HttpStatusCodeController");
        }
        /// <summary>
        /// 200 ok
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetStatus200OK")]
        [ProducesResponseType(StatusCodes.Status200OK)]
        public ActionResult GetStatus200OK()
        {
            return Ok();
        }

        /// <summary>
        /// 201 create
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetStatus201Created")]
        [ProducesResponseType(StatusCodes.Status201Created)]
        public ActionResult GetStatus201Created()
        {
            return Created("/HttpStatusCode/Get",null);
        }

        /// <summary>
        /// 400 bad request
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetStatus400BadRequest")]
        [ProducesResponseType(StatusCodes.Status400BadRequest)]
        public ActionResult GetStatus400BadRequest()
        {
            return BadRequest();
        }

        /// <summary>
        /// 404 not found
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetStatus404NotFound")]
        [ProducesResponseType(StatusCodes.Status404NotFound)]
        public ActionResult GetStatus404NotFound()
        {
            return NotFound();
        }
    }
}